import { createSSRApp } from "vue";
import App from "./App.vue";
import pinia from "@/store";
// 引入 uView UI
import uView from "./components/vk-uview-ui";

import NavBar from "./components/navBar.vue";
import NoMore from "./components/noMore.vue";
import coveringLayer from "./components/coveringLayer.vue";
import ScButton from "./components/sc-ui/scButton.vue";
import ScNavBar from "./components/sc-ui/scNavBar.vue";
import loadMore from "./components/loadMore.vue";
import scLoading from "./components/sc-ui/scLoading.vue";
import scLoadMore from "./components/sc-ui/scLoadMore.vue";
import scTitle from "./components/sc-ui/scTitle.vue";

// 引入导航 hooks（用于兼容旧代码）

export function createApp() {
    const app = createSSRApp(App);

    // 注册 Pinia（必须在其他插件之前）
    app.use(pinia);

    // 注册 uView UI
    app.use(uView);

    // 注册全局组件
    app.component("NavBar", NavBar);
    app.component("NoMore", NoMore);
    app.component("CoveringLayer", coveringLayer);
    app.component("ScButton", ScButton);
    app.component("ScNavBar", ScNavBar);
    app.component("LoadMore", loadMore);
    app.component("ScLoading", scLoading);
    app.component("ScLoadMore", scLoadMore);
    app.component("ScTitle", scTitle);

    return {
        app
    };
}
